VERSION 5.00
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "mshflxgd.ocx"
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form FComisionistas 
   Caption         =   "Comisionistas"
   ClientHeight    =   7485
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   11760
   Icon            =   "FComisionistas.frx":0000
   LinkTopic       =   "Form1"
   MinButton       =   0   'False
   ScaleHeight     =   7485
   ScaleWidth      =   11760
   StartUpPosition =   1  'CenterOwner
   Begin VB.Frame Frame2 
      Height          =   1215
      Left            =   120
      TabIndex        =   1
      Top             =   480
      Width           =   9975
      Begin VB.TextBox TxtNit 
         Height          =   285
         Left            =   1440
         MaxLength       =   15
         TabIndex        =   12
         Top             =   720
         Width           =   1575
      End
      Begin VB.ComboBox CmbTipoServicio 
         Height          =   315
         Left            =   1440
         Style           =   2  'Dropdown List
         TabIndex        =   3
         Top             =   240
         Width           =   4575
      End
      Begin VB.TextBox TxtNombre 
         Height          =   285
         Left            =   3840
         MaxLength       =   250
         TabIndex        =   5
         Top             =   720
         Width           =   4335
      End
      Begin VB.Label LabNit 
         Alignment       =   1  'Right Justify
         Caption         =   "Nit:"
         Height          =   255
         Left            =   720
         TabIndex        =   13
         Top             =   720
         Width           =   615
      End
      Begin VB.Label LabTipoServicio 
         Alignment       =   1  'Right Justify
         Caption         =   "Tipo Servicio:"
         Height          =   255
         Left            =   120
         TabIndex        =   2
         Top             =   240
         Width           =   1215
      End
      Begin MSForms.CommandButton CmdFiltrar 
         Height          =   375
         Left            =   8520
         TabIndex        =   6
         Top             =   720
         Width           =   1335
         Caption         =   " Filtrar"
         PicturePosition =   327683
         Size            =   "2355;661"
         Picture         =   "FComisionistas.frx":058A
         Accelerator     =   70
         FontHeight      =   165
         FontCharSet     =   0
         FontPitchAndFamily=   2
         ParagraphAlign  =   3
      End
      Begin VB.Label Label4 
         Alignment       =   1  'Right Justify
         Caption         =   "Nombre:"
         Height          =   255
         Left            =   3120
         TabIndex        =   4
         Top             =   720
         Width           =   615
      End
   End
   Begin MSHierarchicalFlexGridLib.MSHFlexGrid HFG 
      Height          =   5055
      Left            =   120
      TabIndex        =   7
      Top             =   1800
      Width           =   11535
      _ExtentX        =   20346
      _ExtentY        =   8916
      _Version        =   393216
      FixedCols       =   0
      SelectionMode   =   1
      AllowUserResizing=   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _NumberOfBands  =   1
      _Band(0).Cols   =   2
   End
   Begin VB.Label labTitulo 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "COMISIONISTAS"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   11565
   End
   Begin MSForms.CommandButton CmdEliminar 
      Height          =   375
      Left            =   4680
      TabIndex        =   10
      Top             =   6960
      Width           =   1485
      Caption         =   "  Eliminar"
      PicturePosition =   327683
      Size            =   "2619;661"
      Picture         =   "FComisionistas.frx":0B24
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton CmdSalir 
      Height          =   375
      Left            =   10200
      TabIndex        =   11
      Top             =   6960
      Width           =   1485
      Caption         =   "  Salir"
      PicturePosition =   327683
      Size            =   "2619;661"
      Picture         =   "FComisionistas.frx":0C7E
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton CmdModificar 
      Height          =   375
      Left            =   3000
      TabIndex        =   9
      Top             =   6960
      Width           =   1485
      Caption         =   "  Modificar"
      PicturePosition =   327683
      Size            =   "2619;661"
      Picture         =   "FComisionistas.frx":0DD8
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton CmdNuevo 
      Height          =   375
      Left            =   120
      TabIndex        =   8
      Top             =   6960
      Width           =   2685
      Caption         =   "  Registrar nuevo comisionista"
      PicturePosition =   327683
      Size            =   "4736;661"
      Picture         =   "FComisionistas.frx":1372
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
End
Attribute VB_Name = "FComisionistas"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private dockCont As New ClsDockControls

Public Sub buscar()
    Dim comisionistas As ClsComisionista
    Set comisionistas = New ClsComisionista
    If valorCombo(CmbTipoServicio) > 0 Then
        comisionistas.consultaNitNombreTipo TxtNit.Text, txtnombre.Text, valorCombo(CmbTipoServicio)
    Else
        comisionistas.consultaNitNombre TxtNit.Text, txtnombre.Text
    End If
    llenaGrillaRecordset HFG, comisionistas.orset, Array(0, 0, 100 * 15, 400 * 15), Array("", "", "Nit", "Nombre")
End Sub

Private Sub Form_Load()
    Dim sql As ClsSQL
    Set sql = New ClsSQL
    sql.setCampos Array(tdo_id, tse_nombre)
    sql.setTablas Array(tdo, tse)
    sql.setCondiciones Array(tdo_tse_id & "=" & tse_id)
    Dim q As ClsQuery
    Set q = New ClsQuery
    q.consulta sql.sSelect
    llenaComboRecordset CmbTipoServicio, q.orset, tdo_id, tse_nombre, , True
    CmbTipoServicio.ListIndex = 0
    
    buscar
    'seteamos el contenedor
    dockCont.setContainer Me.Height, Me.Width
    'seteamos los controles del contenedor
    dockCont.dock HFG, True, True, True, True
    dockCont.dock CmdNuevo, False, True, True, False
    dockCont.dock CmdModificar, False, True, True, False
    dockCont.dock CmdEliminar, False, True, True, False
    dockCont.dock CmdSalir, False, False, True, True
    dockCont.dock Me.labTitulo, True, True, False, True
End Sub
Private Sub Form_Resize()
    dockCont.resize Me.Height, Me.Width
End Sub
Private Sub CmdFiltrar_Click()
    buscar
End Sub

Private Sub CmdSalir_Click()
    Unload Me
End Sub

Private Sub CmdNuevo_Click()
    mostrarForm FComisionistasOpt
    buscar
End Sub

Private Sub CmdModificar_Click()
    If HFG.Row > 0 And HFG.TextMatrix(HFG.Row, 0) <> "" Then
        FComisionistasOpt.cargar HFG.TextMatrix(HFG.Row, 0)
        mostrarForm FComisionistasOpt
        buscar
    End If
End Sub

Private Sub CmdEliminar_Click()
    If HFG.Row > 0 And HFG.TextMatrix(HFG.Row, 0) <> "" Then
        If MsgBox(MConfirma_Borrar, vbOKCancel) = vbOK Then
            Dim o As ClsComisionista
            Set o = New ClsComisionista
            o.Borrar HFG.TextMatrix(HFG.Row, 0)
            buscar
        End If
    End If
End Sub

